package epam.bank.rest;

import epam.bank.domain.Payment;
import epam.bank.service.IPaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: dima
 * Date: 07.03.13
 * Time: 0:50
 * To change this template use File | Settings | File Templates.
 */
@Controller
public class HistoryController {

    @Autowired
    private IPaymentService paymentService;


    public void setPaymentService(IPaymentService paymentService) {
        this.paymentService = paymentService;
    }

    @RequestMapping("/index")
    public String listPay(Map<String, Object> map) {

        List<Payment> payments = null;

        payments = paymentService.getPaymentsByInvoice(1L);
        map.put("payments", payments);
        return "history";
    }

    @RequestMapping("/")
    public String home() {
        return "redirect:/index";
    }


}
